import 'package:binggo_bomb/utils/localStorage.dart';

class CardLocalStorageWidget {

  /// 设置卡片数据
  static void setCardNums(int color, Map nums) {
    switch(color) {
      case 0: /// "红色"
        LocalStorage.set<Map>('pinkCards', nums);
        break;
      case 1: /// "蓝色"
        LocalStorage.set<Map>('blueCards', nums);
        break;
      case 2: /// "黄色"
        LocalStorage.set<Map>('yellowCards', nums);
        break;
      case 3: /// "紫色"
        LocalStorage.set<Map>('purpleCards', nums);
        break;
      default:
        break;
    }
  }

  /// 获取卡片数据
  static Map getCardNums(int color) {
    Map res = {};
    switch(color) {
      case 0: /// "红色"
        res = LocalStorage.getKey<Map>('pinkCards') != null ? LocalStorage.getKey<Map>('pinkCards') as Map : {};
        break;
      case 1: /// "蓝色"
        res = LocalStorage.getKey<Map>('blueCards') != null ? (LocalStorage.getKey<Map>('blueCards') as Map) : {};
        break;
      case 2: /// "黄色"
        res = LocalStorage.getKey<Map>('yellowCards') != null ? LocalStorage.getKey<Map>('yellowCards') as Map : {};
        break;
      case 3: /// "紫色"
        res = LocalStorage.getKey<Map>('purpleCards') != null ? LocalStorage.getKey<Map>('purpleCards') as Map : {};
        break;
      default: /// "红色"
        res = LocalStorage.getKey<Map>('pinkCards') != null ? LocalStorage.getKey<Map>('pinkCards') as Map : {};
        break;
    }
    return res;
  }



}